// 首页——居家——商品列表模块
<template>
  <div>
    <div class="page-module page-module-product-group-portrait">
      <!-- 标题 -->
      <div class="page-module-title">
        <h1>{{item.moduleName}}</h1>
        <h3>{{item.moduleDescription}}</h3>
      </div>
      <!-- 中间商品 -->
      <div class="complex">
        <div class="brand-details-list content">
          <div class="clearfix ul flex-cont flex-centerbox lists">
            <div
              class="li"
              v-for="data in item.moduleContent.products.length>6?item.moduleContent.products.slice(0,6):item.moduleContent.products"
              :key="data.productId" @click="goTo(data)"
            >
              <a href="javascript:;">
                <!---->
                <img :src="data.productImg" :alt="data.productTitle" />
                <div>
                  <p>{{data.productTitle}}</p>
                  <span class="sale-price">￥{{data.sellPrice}}</span>

                  <s class="original-price">￥{{data.originalPrice}}</s>
                </div>
              </a>
            </div>
          </div>
        </div>
      </div>
      <!-- 查看更多 -->
      <div class="page-module-more">
        <a href onclick>查看全部</a>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ['item'],
  data () {
    return {}
  },
  mounted () {},
  methods: {
    onChange (index) {
      this.current = index
    },
    goTo (item) {
      // this.$router.push(`/item/${item.productId}`)
      // console.log(item.productId)
      this.$router.push(`/item/${item.productId}`) 
      this.$store.commit('setDataList',item)
    }
  },
  computed: {
    // arrcomputed () {
    //   return this.goodslist.slice(1, 3)
    // }
  }
}
</script>

<style lang="scss">
.page-module {
  background-color: #ffffff;
  margin-top: 15px;
}
img {
  width: 186.5px;
}
.complex {
  .brand-details-list {
    background: #fff;
    overflow: hidden;
    .lists {
      border-top: 1px solid #f5f5f5;
      .li {
        float: left;
        width: 50%;
        height: 295px;
        border-bottom: 1px solid #f5f5f5;
        border-right: 1px solid #f5f5f5;
        box-sizing: border-box;
        -moz-box-sizing: border-box;
        -webkit-box-sizing: border-box;
        -o-box-sizing: border-box;
        -ms-box-sizing: border-box;
        s {
          font-size: 12px;
          color: #ccc;
        }
        a {
          display: block;
          width: 100%;
          position: relative;
          height: 245px;
          color: #000;
          div {
            padding: 0px 16px;
            position: relative;
            margin-top: 10px;
            font-size: 0;
            p {
              padding-top: 5px;
              color: #808080;
              font-size: 14px;
              box-sizing: border-box;
              -moz-box-sizing: border-box;
              -webkit-box-sizing: border-box;
              -o-box-sizing: border-box;
              -ms-box-sizing: border-box;
              overflow: hidden;
              text-overflow: ellipsis;
              white-space: nowrap;
            }
            .sale-price {
              font-size: 16px;
              margin-right: 5px;
            }
          }
        }
      }
    }
  }
}
.flex-cont {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  flex-flow: wrap;
}
.flex-centerbox {
  width: 100%;
  -webkit-box-pack: center;
  -webkit-justify-content: left;
  justify-content: left;
  -webkit-box-align: left;
  -webkit-align-items: center;
  align-items: center;
  margin: 0px;
}
.clearfix {
  zoom: 1;
}
</style>
